﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace testing
{
    class testing
    {
        static void Main(string[] args)
        {
            int n = 4;
            int value = 1;
            int option = 0;
            int[,] matrix = new int[n, n];
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    matrix[i, j] = value;
                    value++;
                }
            }
            value = 1;
            option = 0;
            for (int i = n - 1; i >= 0; i--)
            {
                for (int j = 0; j < n - i; j++)
                {
                    matrix[i + j, j] = value;
                    value++;
                }
            }
            for (int i = 1; i < n; i++)
            {
                for (int j = 0; j < n - i; j++)
                {
                    matrix[j, i + j] = value;
                    value++;
                }
            }
        }
    }
}
